/*  Mash-code. Mash Arts & Métiers Angers embedded software
 *  Copyright (C) 2014  Mash Arts & Métiers Angers
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef PWM_DEVICE_H
#define	PWM_DEVICE_H

#ifdef	__cplusplus
extern "C" {
#endif

#include "./common/struct_raw.h"

/* Choose PWM time period based on input clock selected */
/* P1TPER = (Fcy / (Fpwm * Prescal))-1 */
/* PWM switching frequency is 8 kHz */
/* FCY is 23 MHz */
#define PWM_PERIODE 6249
#define PWM_PDIV PWM_PERIODE>>8




void initPWM( void );
void PWM_disable( void );
void PWM_enable( void );
void PWM_setRaw( struct struct_raw raw );
uint8_t PWM_getStatus( void );

#ifdef	__cplusplus
}
#endif

#endif	/* PWM_DEVICE_H */

